#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
int my_getline(char **lineptr, size_t *size);
int main(void) {
  char *lineptr = NULL;
  size_t size = 0;
  my_getline(&lineptr, &size);
  puts(lineptr);
  free(lineptr);
  return 0;
}

int my_getline(char **lineptr, size_t *size) {
  int ch;
  while ((ch = getchar()) != '\n') {
    *lineptr = realloc(*lineptr, (*size + 1) * sizeof(char));
    if (*lineptr == NULL)
      return 0;
    (*lineptr)[(*size)++] = (char)ch;
  }

  *lineptr = realloc(*lineptr, (*size + 1) * sizeof(char));
  (*lineptr)[*size] = '\0';
  return 1;
}
